home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple II Magazines (PO)
/
Nibble Volume 12, No. 08 (1991-08)(MindCraft Publishing)(Side A)[a].zip
/
Nibble Volume 12, No. 08 (1991-08)(MindCraft Publishing)(Side A)[a].po
/
LPLOT.S
< prev
next >
Wrap
Text File
|
1996-12-24
|
3KB
|
81 lines
********************************
* LPLOT.S Source Code *
* By David Harris *
* (C) 1991 by *
* MindCraft Publ. Corp. *
* Lincoln, MA 01773 *
* Merlin Assembler *
********************************
* This program plots a table of lines using the
* HPLOT_TO and HPOSN calls. The table must be
* identified by a pointer POKED into addresses
* $06 and $07. It must be in the following format:
* BYTE 3N: MSB of X Coordinate for line
* BYTE 3N+1: LSB of X Coordinate for line
* BYTE 3N+2: Y Coordinate for line
* If the MSB of the X coordinate is greater than $7F
* then, instead of drawing a line, LPLOT merely moves
* the high-resolution cursor. If both the MSB and LSB
* of the X coordinate exceed $7F, the end of the table
* is signaled and the routine terminates.
ORG $300
TBL EQU $06 ; $06-07 = POINTER TO TABLE
XTEMP EQU $08 ; $08 = TEMP STORAGE
HPOSN EQU $F411 ; MOVE HIGH-RES CURSOR
HPLOT_TO EQU $F53A ; DRAW A LINE TO A POINT
LOOP LDY #$00 ; START OF TABLE
LDA (TBL),Y ; GET X MSB
BMI SKIP ; IF MSB >= $80 THEN SKIP
TAX ; X MSB IN X REGISTER
INY ; NEXT BYTE
LDA (TBL),Y ; GET X LSB
STA XTEMP ; STORE TEMPORARY
INY ; NEXT BYTE
LDA (TBL),Y ; GET Y COORDINATE
TAY ; Y POS IN Y REGISTER
LDA XTEMP ; X LSB IN ACCUMULATOR
* The following values should be in each register,
* in preparation for the call to HPLOT_TO:
* X: X MSB OF COORDINATE
* ACC: X LSB OF COORDINATE
* Y: Y VALUE OF COORDINATE
JSR HPLOT_TO ; DRAW LINE
CLC ; ADVANCE TABLE POINTER
REPEAT LDA TBL ; GET LSB OF TABLE
ADC #$03 ; MOVE TO NEXT ENTRIES
STA TBL ; AND STORE
LDA TBL+1 ; GET MSB OF TABLE
ADC #$00 ; WRAP AROUND TO NEXT PAGE
STA TBL+1 ; AND STORE
CLC
BCC LOOP ; REPEAT CYCLE
SKIP SEC
SBC #$80 ; CLEAR HIGH BIT
STA XTEMP ; STORE TEMPORARY
INY ; NEXT BYTE
LDA (TBL),Y ; GET X LSB
BMI QUIT ; IF LSB >= $80 THEN QUIT
TAX ; ELSE STORE IN X REGISTER
INY ; NEXT BYTE
LDA (TBL),Y ; GET Y COORDINATE
LDY XTEMP ; RECALL TEMPORARY
* The following values should be in each register,
* in preparation for the call to HPOSN:
* Y: X MSB OF COORDINATE
* X: X LSB OF COORDINATE
* ACC: Y VALUE OF COORDINATE
* Note that they differ from the HPLOT_TO registers.
JSR HPOSN ; MOVE CURSOR
CLC
BCC REPEAT ; REPEAT CYCLE
QUIT RTS ; ALL DONE